<!DOCTYPE html SYSTEM "about:legacy-compat">
<html lang="en"><head><META http-equiv="Content-Type" content="text/html; charset=iso-8859-15"><title>Apache JMeter
          -
          User's Manual: Building an Advanced Web Test Plan</title><meta name="viewport" content="width=device-width, initial-scale=1"><link href="http://fonts.googleapis.com/css?family=Merriweather:400normal" rel="stylesheet" type="text/css"><link rel="stylesheet" type="text/css" href="../css/new-style.css"></head><body role="document"><a href="#content" class="hidden">Main content</a><div class="header"><!--
            APACHE LOGO
          --><div><a href="http://www.apache.org"><img title="Apache Software Foundation" width="290" height="75" src="../images/asf-logo.png" alt="Logo ASF"></a></div><!--
              PROJECT LOGO
            --><div><a href="http://jmeter.apache.org/"><img src="../images/logo.jpg" alt="Apache JMeter"></a></div><div class="twitter"><div><a href="https://twitter.com/share" class="twitter-share-button" data-text="Powerful Load Testing with Apache #JMeter" data-via="ApacheJMeter" data-lang="en-gb" data-size="large">Tweet</a><script>
            (function(d,s,id){
              var js,
                  fjs=d.getElementsByTagName(s)[0],
                  p=/^http:/.test(d.location)?'http':'https';
              if (!d.getElementById(id)) {
                  js=d.createElement(s);
                  js.id=id;
                  js.src=p+'://platform.twitter.com/widgets.js';
                  fjs.parentNode.insertBefore(js,fjs);
              }
            })(document, 'script', 'twitter-wjs');
              </script></div><div><a href="https://twitter.com/ApacheJMeter" class="twitter-follow-button" data-show-count="false" data-lang="en-gb" data-size="large">Follow</a><script>(function(d,s,id){
                var js,
                    fjs=d.getElementsByTagName(s)[0],
                    p=/^http:/.test(d.location)?'http':'https';
                if (!d.getElementById(id)) {
                    js=d.createElement(s);
                    js.id=id;
                    js.src=p+'://platform.twitter.com/widgets.js';
                    fjs.parentNode.insertBefore(js,fjs);
                }
            })(document, 'script', 'twitter-wjs');
              </script></div></div><div class="banner"><iframe src="http://www.apache.org/ads/bannerbar.html" style="border-width:0;" frameborder="0" scrolling="no"></iframe><div class="clear"></div></div></div><div class="nav"><ul class="menu"><li><div class="menu-title">About</div><ul><li><a href="../index.html">Overview</a></li><li><a href="http://twitter.com/ApacheJMeter">JMeter on Twitter<img src="../images/twitter.png" alt="Icon for JMeter on Twitter"></a></li><li><a href="../issues.html">Issue Tracking</a></li><li><a href="http://projects.apache.org/feeds/rss/jmeter.xml">Subscribe to What's New</a></li><li><a href="http://www.apache.org/licenses/">License</a></li></ul></li></ul><ul class="menu"><li><div class="menu-title">Download</div><ul><li><a href="../download_jmeter.cgi">Download Releases</a></li><li><a href="../nightly.html">Developer (Nightly) Builds</a></li></ul></li></ul><ul class="menu"><li><div class="menu-title">Documentation</div><ul><li><a href="../changes.html">Changes per version</a></li><li><a href="../usermanual/get-started.html">Get Started</a></li><li><a href="../usermanual/index.html">User Manual</a></li><li><a href="../usermanual/best-practices.html">Best Practices</a></li><li><a href="../usermanual/component_reference.html">Component Reference</a></li><li><a href="../usermanual/functions.html">Functions Reference</a></li><li><a href="../api/index.html">Javadocs</a></li><li><a href="../building.html">Building JMeter and Add-Ons</a></li><li><a href="http://wiki.apache.org/jmeter">JMeter Wiki</a></li><li><a href="http://wiki.apache.org/jmeter/JMeterFAQ">FAQ (Wiki)</a></li></ul></li></ul><ul class="menu"><li><div class="menu-title">Tutorials (PDF format)</div><ul><li><a href="../usermanual/jmeter_distributed_testing_step_by_step.pdf">Distributed Testing</a></li><li><a href="../usermanual/jmeter_proxy_step_by_step.pdf">Recording Tests</a></li><li><a href="../usermanual/junitsampler_tutorial.pdf">JUnit Sampler</a></li><li><a href="../usermanual/jmeter_accesslog_sampler_step_by_step.pdf">Access Log Sampler</a></li><li><a href="../extending/jmeter_tutorial.pdf">Extending JMeter</a></li></ul></li></ul><ul class="menu"><li><div class="menu-title">Community</div><ul><li><a href="http://wiki.apache.org/jmeter/JMeterCommitters">Contributors</a></li><li><a href="../mail.html">Mailing Lists</a></li><li><a href="../svnindex.html">SVN Repositories</a></li></ul></li></ul><ul class="menu"><li><div class="menu-title">Foundation</div><ul><li><a href="http://www.apache.org/">ASF</a></li><li><a href="http://www.apache.org/foundation/getinvolved.html">Get Involved in the ASF</a></li><li><a href="http://www.apache.org/foundation/sponsorship.html">Sponsorship</a></li><li><a href="http://www.apache.org/foundation/thanks.html">Thanks</a></li></ul></li></ul></div><div class="main" id="content"><ul class="pagelinks"><li><a href="build-web-test-plan.html">&lt; Prev</a></li><li><a href="../index.html">Index</a></li><li><a href="build-db-test-plan.html">Next &gt;</a></li></ul><div class="section"><h1 id="building">6. Building an Advanced Web Test Plan<a class="sectionlink" href="#building" title="Link to here">&para;</a></h1>
<p>In this section, you will learn how to create advanced
<a href="build-test-plan.html">Test Plans</a> to test a Web site.</p>

<p>For an example of a basic Test Plan, see
<a href="build-web-test-plan.html">Building a Web Test Plan</a>.</p></div><div class="section"><h1 id="session_url_rewriting">6.1 Handling User Sessions With URL Rewriting<a class="sectionlink" href="#session_url_rewriting" title="Link to here">&para;</a></h1>
<p>If your web application uses URL rewriting rather than cookies to save session information,
then you'll need to do a bit of extra work to test your site.</p>
<p>To respond correctly to URL rewriting, JMeter needs to parse the HTML
received from the server and retrieve the unique session ID.  Use the appropriate <a href="../usermanual/component_reference.html#HTTP_URL_Re-writing_Modifier">HTTP URL Re-writing Modifier</a>
to accomplish this.  Simply enter the name of your session ID parameter into the modifier, and it
will find it and add it to each request.  If the request already has a value, it will be replaced.
If "Cache Session Id?" is checked, then the last found session id will be saved,
and will be used if the previous HTTP sample does not contain a session id.
</p>

<div class="example"><div class="title">URL Rewriting Example<a class="sectionlink" href="#url_rewriting_example" title="Link to here">&para;</a></div>
<p>Download <a href="../demos/URLRewritingExample.jmx">this example</a>. In Figure 1 is shown a 
test plan using URL rewriting.  Note that the URL Re-writing modifier is added to the SimpleController,
thus assuring that it will only affect requests under that SimpleController.</p>
<figure><a href="../images/screenshots/url_rewrite_example_a.png"><img src="../images/screenshots/url_rewrite_example_a.png" width="" height="" alt="Figure 1 - Test Tree"></a><figcaption>Figure 1 - Test Tree</figcaption></figure>
<p>In Figure 2, we see the URL Re-writing modifier GUI, which just has a field for the user to specify
the name of the session ID parameter.  There is also a checkbox for indicating that the session ID should
be part of the path (separated by a ";"), rather than a request parameter</p>
<figure><a href="../images/screenshots/url_rewrite_example_b.png"><img src="../images/screenshots/url_rewrite_example_b.png" width="" height="" alt="Figure 2 - Request parameters"></a><figcaption>Figure 2 - Request parameters</figcaption></figure>
</div>
</div><div class="section"><h1 id="header_manager">6.2 Using a Header Manager<a class="sectionlink" href="#header_manager" title="Link to here">&para;</a></h1>
<p>The <a href="../usermanual/component_reference.html#HTTP_Header_Manager">HTTP Header Manager</a> lets you customize what information
JMeter sends in the HTTP request header.  This header includes properties like "User-Agent",
"Pragma", "Referer", etc.</p>
<p>The <a href="../usermanual/component_reference.html#HTTP_Header_Manager">HTTP Header Manager</a>, like the <a href="../usermanual/component_reference.html#HTTP_Cookie_Manager">HTTP Cookie Manager</a>,
should probably be added at the Thread Group level, unless for some reason you wish to
specify different headers for the different <a href="../usermanual/component_reference.html#HTTP_Request">HTTP Request</a> objects in
your test.</p>

</div><ul class="pagelinks"><li><a href="build-web-test-plan.html">&lt; Prev</a></li><li><a href="../index.html">Index</a></li><li><a href="build-db-test-plan.html">Next &gt;</a></li></ul></div><div class="footer"><div class="copyright">
            Copyright &copy;
            1999 &ndash;
            2015
            , Apache Software Foundation
          </div><div class="trademarks">Apache, Apache JMeter, JMeter, the Apache
            feather, and the Apache JMeter logo are
            trademarks of the
            Apache Software Foundation.
          </div></div></body></html>